/**
 * 
 */
package com.et114.modules.products.supplier.services;

import java.util.List;

import com.et114.components.simpletable.DataList;
import com.et114.core.services.impl.BaseServicesImpl;
import com.et114.core.utility.FileUploadUtil;
import com.et114.modules.products.supplier.vo.ProSuppliers;
import com.et114.modules.products.supplier.dao.SupplierDao;
/*
 * @author guanhw
 */
public class SupplierServiceImpl extends BaseServicesImpl {
	private SupplierDao supplierDao ;

	public void setSupplierDao ( SupplierDao supplierDao ) {
		this.supplierDao = supplierDao;
	}

	public DataList  querySuppliers( ProSuppliers vo ) throws Exception {
		return supplierDao.querySuppliers ( vo ) ; 
	}
	
	public DataList  querySuppliers( ) throws Exception {
		return supplierDao.querySuppliers ( null ) ; 
	}	
	
	public Long saveSupplier( ProSuppliers vo ) throws Exception { 
		return supplierDao.saveSupplier ( vo ) ; 
	}
	
	public void updateSupplier( ProSuppliers vo ) throws Exception {  
		supplierDao.updateSupplier ( vo ) ;
	}
	
	public void removeSupplier( Long id ) throws Exception  {
		ProSuppliers ps = getProSupplierById( id ) ; 
		if ( ps != null ) {
			FileUploadUtil.removeFile ( ps.getProSupplierImg ( ) ) ; 
			supplierDao.removeSupplier ( id ) ; 
		}
	}
	 
	public ProSuppliers getProSupplierById( Long sid  ) throws Exception {
		return supplierDao.getProSupplierById ( sid ) ; 
	}
	
	public List< ProSuppliers > querySuppliersList( ProSuppliers vo ) throws Exception { 
		return supplierDao.querySuppliersList ( vo ) ; 
	}
}
